package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.entity.EndUser;
import com.qf.mapper.EndUserDao;
import com.qf.service.LoginService;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {

    private EndUserDao endUserDao;

    public LoginServiceImpl(EndUserDao endUserDao) {
        this.endUserDao = endUserDao;
    }

    @Override
    public EndUser queryByName(String name) {
        QueryWrapper<EndUser> qw = new QueryWrapper<>();
        qw.eq("end_name",name);
        qw.eq("state",1);
        EndUser endUser = endUserDao.selectOne(qw);
        return endUser;
    }

    public EndUser queryByNameAndPassWord(String name, String password) {
        QueryWrapper<EndUser> qw = new QueryWrapper<>();
        qw.eq("end_name",name);
        qw.eq("end_password",password);
        EndUser endUser = endUserDao.selectOne(qw);
        return endUser;
    }
}
